package com.example.demo.design.demo16_state;

/**
 * Created by 蔡超 on 2018/10/4.
 */
public class Work {
    private Integer hour;
    private State state;

    public Work() {
        this.state = new Monring();
    }

    public Integer getHour() {
        return hour;
    }

    public void setHour(Integer hour) {
        this.hour = hour;
    }

    public State getState() {
        return state;
    }

    public void setState(State state) {
        this.state = state;
    }

    public void writeProgrammer(){
        if(hour < 12){
            setState(new Monring());
        }else if(hour <13){
            setState(new Noon());
        }else {
            setState(new Afternoon());
        }
    }

}
